import java.util.Scanner;

public class fangfa_mianji {
    public static void main(String[] args) {
        Scanner shuru = new Scanner(System.in);
        while (true){
        System.out.println("请输入图形（三角形，长方形，正方形）：");
        String tuxing = shuru.next();
        System.out.println("请输入长：");
        double chang = shuru.nextDouble();
        System.out.println("请输入高：");
        double kuan = shuru.nextDouble();
        switch (tuxing) {
            case "三角形":
                getTrianglesArea(chang, kuan);
                break;
            case "长方形":
                getRectangleArea(chang, kuan);
                break;
            case "正方形":
                getSquareArea(chang, kuan);
                break;
            default:
                System.out.println("请重新输入");
                break;
        }
        }
    }

    static void getTrianglesArea (double a,double b) {
        System.out.println("面积为："+(a*b/2));
    }
    static void  getRectangleArea(double a,double b){
        System.out.println("面积为："+(a*b));
    }
    static void getSquareArea (double a,double b) {
        System.out.println("面积为："+(a*b));
    }

}
